import config from "@/config/config.js";
import http from "@/api/http.js";


const taskRequest = {
    loadTasks(Task,page=1,limit=10,callBack){
        let token = localStorage.getItem("token");
        if(token){
            let url = config.defectBaseUrl + "/task/list?page="+page + "&limit="+limit;
            if(Task){
                if (Task.documentsId){
                    url += "&documentsId=" + Task.documentsId;
                }
                if (Task.detectionName){
                    url += "&detectionName=" + Task.detectionName;
                }
                if (Task.materialNumber){
                    url += "&materialNumber=" + Task.materialNumber;
                }
                if (Task.materialName){
                    url += "&materialName=" + Task.materialName;
                }
                if (Task.taskNumber){
                    url += "&taskNumber=" + Task.taskNumber;
                }
                if (Task.location){
                    url += "&location=" + Task.location;
                }
                if (Task.taskStatus){
                    url += "&taskStatus=" + Task.taskStatus;
                }
            }
            http.get(url,callBack);
        }else {
            callBack(undefined);
        }
    },






}

export default taskRequest